package com.hotel.ssm.dao;

import com.hotel.ssm.domain.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IProductDao {

    //根据id查询产品
    @Select("select * from product where id = #{id}")
    public Product findById(String id) throws Exception;

    //查询所有的产品信息
    @Select("select * from product")
    public List<Product> findAll() throws Exception;

    @Insert("insert into product(productNum, productName, cityName, departureTime, productPrice, " +
            "productDesc, productStatus) value (#{productNum}, #{productName}, #{cityName}, #{departureTime}, #{productPrice}, " +
            "#{productDesc}, #{productStatus})")
    void save(Product product);
}
